package RabbitUI.filetype;

import java.io.File;
import java.util.Collection;
import java.util.Iterator;

import javax.swing.filechooser.FileFilter;

public class read_file_filter extends FileFilter {
	Collection<String>  filetype;
	public read_file_filter(Collection<String> filtyp){
		filetype=filtyp;
	}
	public boolean accept(File f) {
		if (f.canRead()){
			if (f.isDirectory()){return true;}
			else {
				String fil=f.getName();
				for (Iterator<String> e=filetype.iterator();e.hasNext();){
					if (fil.endsWith(e.next())) return true;
				}
			}
		}
		return false;
	}
	public String getDescription() {
		return  filetype.toString();
	}

}
